<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="entitybean.systemtree.EntityBeanSystemtree;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
	<%
		@SuppressWarnings("unchecked")  
		HashSet<Integer> RolePower = (HashSet<Integer>)request.getSession().getAttribute("RolePower");
		@SuppressWarnings("unchecked")  		
		List<EntityBeanSystemtree> listsystemtree=(List<EntityBeanSystemtree>)request.getSession().getAttribute("listSystemtree");
	%>

	<head>
		<base href="<%=basePath%>">
		<title>管理员管理界面</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--  <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/css_style.css">-->
		<link href="<%=request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css" />
	
	</head>
	<script language="javascript">
function tupian(idt){
    var nametu="xiaotu"+idt;
    var tp = document.getElementById(nametu);
    tp.src="../images/ico05.gif";//图片ico04为白色的正方形
	
	for(var i=1;i<5000;i++)
	{
	  
	  var nametu2="xiaotu"+i;
	  if(i!=idt*1)
	  {
	    var tp2=document.getElementById('xiaotu'+i);
		if(tp2!=undefined)
	    {tp2.src="../images/ico06.gif";}//图片ico06为蓝色的正方形
	  }
	}
}

function list(idstr){
	var name1="subtree"+idstr;
	var name2="img"+idstr;
	var objectobj=document.all(name1);
	var imgobj=document.all(name2);
	
	
	//alert(imgobj);
	
	if(objectobj.style.display=="none"){
		for(i=1;i<150;i++){
			var name3="img"+i;
			var name="subtree"+i;
			var o=document.all(name);
			if(o!=undefined){
				o.style.display="none";
				var image=document.all(name3);
				//alert(image);
				image.src="../images/wwr_06.jpg";
			}
		}
		objectobj.style.display="";
		imgobj.src="../images/wwr_10.jpg";
	}
	else{
		objectobj.style.display="none";
		imgobj.src="../images/wwr_06.jpg";
	}
}


	
	
	
	
var Tid;
function stateChanged()
	{ 
	if (xmlHttp.readyState==4)
	{	 
		document.getElementById("jd_"+Tid+"_c").innerHTML=xmlHttp.responseText;
	}
	}

function show_c_jd(id,lv)
	{
		Tid=id;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
 		{
  			alert ("浏览器不支持AJAX");
  			return;
  		} 
		var url="<%=request.getContextPath() %>/show_systemtree.do?method=show_systemtree";//绝对地址
		url=url+"&q="+id+"&lv="+lv;
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
}
function fuckyou(str,lv)
{
	//list(str);
	var div_name="jd_"+str+"_c";
	var ob=document.getElementById("jd_"+str+"_c");
	if(ob.style.display=="block" || ob.style.display=="")
	{
		ob.style.display="none";
	}
	else
	{
		ob.style.display="block";
		show_c_jd(str,lv);
    	}
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  	xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  		catch (e)
    {
   	 	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
</script>

	<body>
	
			<div class="admin_left">
				<%
						for (int i = 0; i <listsystemtree.size(); i++) {
						
						if (RolePower.contains(listsystemtree.get(i).getF_jd())) {
					%>
					<ul>
					<h2>
						<span><img name="img<%=listsystemtree.get(i).getF_jd()%>" id="img<%=listsystemtree.get(i).getF_jd()%>" src="<%=request.getContextPath()%>/images/wwr_06.jpg" />
						
						
						</span>
					
					<div style="cursor:hand" id="jd_<%=listsystemtree.get(i).getF_jd()%>"
						class="font_12"
						onClick="fuckyou(<%=listsystemtree.get(i).getF_jd()%>,<%=listsystemtree.get(i).getLv()%>)">
				          <%=listsystemtree.get(i).getJd_name()%></div></h2>
				          
				          
					<div id="jd_<%=listsystemtree.get(i).getF_jd()%>_c"
						style="display: none" class="system_child" >
						<%="数据载入中"%></div>
					<%
						}
						else
						{
						System.out.println("没有数据");
						}
						}
					%>
		    </div>
	</body>
</html>